package org.richin.support.orm;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

public interface DaoSupport<T, ID extends java.io.Serializable> {
	/**
	 * save entity
	 * @param entity
	 */
	public void save(T entity);
	public void saveObject(Object entity);
	public void saveAll(Collection<T> entities);
	public void update(T entity);
	public void updateObject(Object entity);
	public void updateAll(List<T> entities);
	/*------------CRUD-----------*/
	public void delete(T entity);
	public void delete(ID... ids);
	public void deleteObject(Object entity);
	public void deleteAll(Collection<T> entities);
	
	public T get(ID id);
	public T load(ID id);
	public T findByUnique(String propertyName, Object value);
	/*------------search-----------*/
	public List<T> getAll();
	public Page<T> getAll(Page<T> page);
	public List<T> getAll(boolean cacheQueries);
	 public List<T> find(String queryString, Object...values);
		public List<T> findByProperty(String propertyName, Object value);
		public List<T> findByLike(String propertyName, String value);
		public T findUniqueByProperty(String propertyName, Object value);
		public boolean isNotUnique(T entity, String names);
	 public String getIdName(Class<T> entityClass);
}
